<!DOCTYPE html>
<html lang="zh">
<head>
  <title>golang</title>
  {{template "./layout-head.html" .}}
  <link rel="stylesheet" href="/static/plugins/highlight/styles/dark.css" />
</head>

<body>
  <header>
    {{template "./layout-menu.html"}}
  </header>
  <article>
    {{range $index, $elem := .articleList}}
    <section>
      <div class="title-header">
        <h1><a href="/article/{{$elem.Id}}">{{$elem.Title}}</a></h1>
        <span>（{{$elem.UpdatedAt}}）</span>
      </div>
      <div class="description">
        <div class="imgdiv">{{str2html $elem.Img}}</div><br>
        {{str2html $elem.Content}}
      </div>
    </section>
    {{end}}
  </article>
  <div id="Pagination" class="pagination"><!-- 这里显示分页 --></div>
  <footer>
    {{template "./layout-footer.html"}}
  </footer>
  <script src="./static/plugins/highlight/highlight.pack.js"></script>
  <script src="http://apps.bdimg.com/libs/zepto/1.1.4/zepto.min.js"></script>
  <script src="./static/dist/js/jquery.pagination.js"></script>
  <script type="text/javascript">
    $(function(){
      hljs.initHighlightingOnLoad();//代码高亮
      
      var current = {{.pageNo}}
      var pageSize = {{.pageSize}}
      var totalIndex = {{.total}}
      $("#Pagination").pagination(totalIndex, {
        num_edge_entries: 1, //边缘页数
        num_display_entries: 4, //主体页数
        prev_text: "« 上一页",
        next_text: "下一页 »",
        current_page: current,
        link_to: "/?pageNo=__id__&pageSize="+pageSize,
        callback: function (page_index, jq) {
          return true;
        },
        items_per_page: pageSize, //每页多少条
        load_first_page: false
      });
    });
    </script>
</body>

</html>